import { request } from '@/service/request';

// ---------- Record Begin ----------

/** get record page */
export function fetchGetCjRecordPage(params?: Api.Sampling.RecordSearchParams) {
  return request<Api.Sampling.RecordList>({
    url: '/cj_record/page',
    method: 'GET',
    params
  });
}

/** add record info */
export function fetchAddCjRecord(data: Api.Sampling.RecordEdit) {
  return request<boolean>({
    url: '/cj_record/',
    method: 'POST',
    data
  });
}

/** update record info */
export function fetchUpdateCjRecord(data: Api.Sampling.RecordEdit) {
  return request<boolean>({
    url: '/cj_record/',
    method: 'PUT',
    data
  });
}

/** edit delete record */
export function fetchDeleteCjRecord(data: Api.Common.DeleteParams) {
  return request<boolean>({
    url: '/cj_record/',
    method: 'DELETE',
    data
  });
}

export function fetchCjRecordBindProject(data: Api.Sampling.CjRecordBindProjectDTO) {
  return request<boolean>({
    url: '/cj_record/bind_project',
    method: 'POST',
    data
  });
}

export function fetchCjRecordExtInfo(recordId: string, orgId: string) {
  return request<Api.Sampling.CjRecord.ExtInfo>({
    url: `/cj_record/ext_info/${recordId}/${orgId}`,
    method: 'GET'
  });
}

export function fetchCjRecordAuth(data: Api.Sampling.CjRecord.AuthModel) {
  return request<boolean>({
    url: `/cj_audit_record/auth`,
    method: 'POST',
    data
  });
}
